<template>
  <div>
    <div class="isshow" v-show="isoks.contents">
      <span class="city">{{title}}</span>
      <h3>电影</h3>
    </div>
    <headers v-scrollself="isoks"></headers>
    <div class="middle" :style="{'padding-top':(isoks.contents?'0.8rem':'')}">
      <!-- <a @click="sendid('ishot')">正在热播</a>
      <a @click="sendid('willcoming')">即将上映</a>-->
      <router-link to="/Movies/ishot">正在热播</router-link>
      <router-link to="/Movies/willcoming">即将上映</router-link>
    </div>
    <router-view></router-view>
  </div>
</template>
<script>
import headers from "@/components/homeheader/header.vue";
export default {
  data() {
    return {
      isoks: { contents: false },
    };
  },
  computed:{
    title() {
      return this.$store.state.city.name;
    }
  },
  components: {
    headers
  },
  directives: {   //滚动到一定程度不显示
    scrollself(el, t) {
      window.document.onscroll = () => {
        if (document.documentElement.scrollTop > el.offsetHeight) {
          t.value.contents = true;
        } else {
          t.value.contents = false;
        }
      };
    }
  },
};
</script>
<style  scoped>
.middle {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 1rem;
  position: sticky;
  top: 0;
  background-color: white;
}
.isshow {
  position: fixed;
  z-index: 100;
  height: 0.8rem;
  text-align: center;
  width: 100%;
  font-size: 0.4rem;
  line-height: 0.4rem;
  padding: 0.15rem 0;
}
/* .addclass{
  padding-top:0.8rem
} */
.city {
  position: fixed;
  top: 0.2rem;
  left: 0.5rem;
  font-size: 0.2rem;
}
</style>